import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

//Flutter AspectRatio
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

// This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(title: const Text("Flutter App")),
        body: const HomePage(),
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
// TODO: implement build
    return Container(
      width: 150,
      color: Colors.yellow,
      child: AspectRatio(
        aspectRatio: 1,
        child: Image.asset(
          "images/1.png",
          height: 300,
          width: 300,
        ),
        // child: LayoutDemo(),
      ),
    );
  }
}

class LayoutDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
// TODO: implement build
    return AspectRatio(
      aspectRatio: 2 / 1,
      child: Container(
        color: Colors.amberAccent,
      ),
    );
  }
}
